home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / tvision / msgcls / readme.txt next >
Encoding:
Text File  |  1992-01-30  |  2.2 KB  |  73 lines

  1.  
  2. TLNMSG.H has the prototype for the postMsg(const char *) and
  3. postInfo(int, const char *) functions.  You don't have to use these
  4. functions if you don't want to, but they simplify the calling parameters
  5. and are easy to call from within "straight C" functions.  Actually,
  6. we are compiling standalone versions of our software and an integrated
  7. version.  One function call to postInfo or postMsg works in both cases
  8. using conditional compilation.  For example:
  9.  
  10. #if defined(APPLICATION)
  11. #include "tlnmsg.h"
  12. #else
  13. #include <stdio.h>
  14. void postMsg(const char * msg)
  15. {
  16.   printf("%s\n", msg);
  17. }
  18. void postInfo(int line, const char * msg)
  19. {
  20.   printf("%s\n", msg);
  21. }
  22. #endif
  23.  
  24. This is an example of how to use the two classes defined in TLNMSG.CPP.
  25. Note that you have to explicitly call getEvent(TEvent&) to find out
  26. if the user pressed escape.  Another method would be to make kbEsc a
  27. case in your main handleEvent loop.  For us, that was impractical
  28. considering there is no handleEvent loop in our stand alone code.
  29.  
  30. void handleEvent(event)
  31. {
  32.    switch( event.message.command )
  33.    {
  34.      ...
  35.  
  36.      case cmTestCase:
  37.             TEvent anEvent;
  38.             Boolean userBreak = False;
  39.  
  40.             postInfo(1, " Line 1");
  41.             postInfo(2, " Line 2");
  42.  
  43.             // This should be highlighted in blue as
  44.             // it is the last line in the box.
  45.  
  46.             postInfo(10, "\003Press escape to continue");
  47.  
  48.             for (i = 0; i < 1000 && !userBreak; ++i) {
  49.               sprintf(msg, "\003Compiling Line: %2d", i);
  50.               postInfo(4, msg);
  51.  
  52.               // break if the user presses escape
  53.  
  54.               getEvent(anEvent);
  55.               userBreak = (Boolean)
  56.                           ((anEvent.what == evKeyboard) &&
  57.                            (anEvent.keyDown.keyCode == kbEsc));
  58.  
  59.             } // endfor
  60.  
  61.             postInfo(-1, "");
  62.             if (userBreak) postMsg("Exited on user break");
  63.  
  64.             break;
  65.      ...
  66.    } // endswitch
  67.  
  68. } // end handleEvent()
  69.  
  70. Comments and criticisms are welcome, but questions may or may not
  71. be answered (call Borland, they get paid for it!)  Send all
  72. correspondance to Rick Hagerbaumer c/o 72700,351
  73.